﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using ST.Buz.Base.Entity;
using ST.Buz.Base.Enums;

namespace ST.Buz.Base.Mapping
{
	public partial class Map_IMS_Partner : IEntityTypeConfiguration<IMS_Partner>
	{
		public void Configure(EntityTypeBuilder<IMS_Partner> builder)
		{
			builder.HasKey(e => new { e.ID })
				.HasName("PK_IMS_Partner")
				.IsClustered(false);

			builder.HasIndex(e => new { e.Type })
				.HasName("IX_IMS_Partner_Type")
				.IsClustered(true);

			builder.Property(e => e.TotalCashIn)
				.HasDefaultValueSql("((0))")
				.ValueGeneratedNever()
				.HasColumnType("decimal(18,2)");

			builder.Property(e => e.TotalCashBonus)
				.HasDefaultValueSql("((0))")
				.ValueGeneratedNever()
				.HasColumnType("decimal(18,2)");

			builder.Property(e => e.TotalCashOut)
				.HasDefaultValueSql("((0))")
				.ValueGeneratedNever()
				.HasColumnType("decimal(18,2)");

			builder.Property(e => e.TotalCashBalance)
				.HasDefaultValueSql("((0))")
				.ValueGeneratedNever()
				.HasColumnType("decimal(18,2)");

			builder.Property(e => e.DebtLimit)
				.HasDefaultValueSql("((0))")
				.ValueGeneratedNever()
				.HasColumnType("decimal(18,2)");

			builder.Property(e => e.AddDate)
				.HasDefaultValueSql("(getdate())")
				.ValueGeneratedNever();
		}
	}
}
